<template>
  <div>

    <div class="Logout">
      <Logout>退出</Logout>
    </div>
    <h1>更新教师信息</h1>

    <el-input style="width: 800px" size="medium" v-model="tno" placeholder="请输入教师编号" prefix-icon="el-icon-s-check" maxlength="10" show-word-limit clearable></el-input>
    <el-input style="width: 800px" size="medium" v-model="tname" placeholder="请输入教师名称" prefix-icon="el-icon-user-solid" maxlength="50" show-word-limit clearable></el-input>
    <el-input style="width: 800px" size="medium" v-model="tlevel" placeholder="请输入等级" prefix-icon="el-icon-s-data" maxlength="2" show-word-limit clearable></el-input>
    <el-input style="width: 800px" size="medium" v-model="tcharacter" placeholder="请输入教师特长" prefix-icon="el-icon-s-management" maxlength="50" show-word-limit clearable></el-input>
    <el-row>
      <el-button @click="updateBtn" type="success" icon="el-icon-upload">提交</el-button>
    </el-row>
  </div>
</template>

<script>
import Logout from "./Logout";
export default {
  name: "UpdateTeacher",
  components:{Logout},
  created(){
    this.tno = this.$route.query.tno;
    this.tname = this.$route.query.tname;
    this.tlevel = this.$route.query.tlever;
    this.tcharacter = this.$route.query.tcharacter;
  },
  methods: {
    search(){

    },
    updateBtn(){
      let data = {
        tno:this.tno,
        tname:this.tname,
        tlevel:this.tlevel,
        tcharacter:this.tcharacter
      };
      this.$axios.post(`/EditTeacher`,data).then((res) => {
        console.log(res);
        if(res.data ==="更新成功"){
          alert("更新成功");

        } else {
          alert(res.data.msg)
        }
      });


    }
  },

  data() {
    return {
      tno:'',
      tname:'',
      tlevel:'',
      tcharacter:''
    }
  }
}
</script>

<style scoped>

</style>
